package com.koron.order.overhaul.controller;

import com.koron.bean.base.Response;
import com.koron.bean.system.staff.vo.EamUser;
import com.koron.common.core.annocation.CasUser;
import com.koron.order.overhaul.service.OverhaulOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author twcao
 * @title: OverhaulOrderToAcceptController
 * @projectName GDH_EAM_V2
 * @description: 大修工单-待接收
 * @date 2021/10/219:11
 */
@Slf4j
@Api(tags = "大修工单-待接收")
@RestController
@RequestMapping("/overhaul/toAccept")
public class OverhaulOrderToAcceptController {

    @Autowired
    private OverhaulOrderService overhaulOrderService;

    @ApiOperation(value = "待验收(status = 5)，提交工作流")
    @GetMapping("/{orderId}")
    public Response<Boolean> toAccept(@CasUser @ApiIgnore EamUser user, @PathVariable("orderId") String orderId) {
        log.info("待验收(status = 5)，提交工作流，orderId = {}", orderId);
        return Response.ok("操作成功", ADOConnection.runTask(user.getCurrDs(), overhaulOrderService, "toAccept", Boolean.class, orderId));
    }
}
